<%@ page language="java" pageEncoding="UTF-8" buffer="16kb"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<%@ include file="/module/js.jsp"%>
<script>
	$(document)
			.ready(
					function() {
						var _form=$("#semesterForm").validate();
						$('#btnBack')
								.click(
										function() {
											document.semesterForm.action = "${basePath}/semesterSummary/semesterSummaryIndex";
											document.semesterForm.submit();
										});
						//保存
						$("#btnSave").click(function() {
							if(_form.form()){
							 if(validateSqxm()){	
								$("#btnSave").attr("disabled","disabled");
								$("#flag").val(1);
								  document.semesterForm.action ="${basePath}/semesterSummary/addSemesterSummary";
								  document.semesterForm.submit();
							 }
							}
						});
					  //保存继续新增
						$("#btnSave2").click(function() {
							if(_form.form()){
								 if(validateSqxm()){
							    $("#flag").val(2);
								$("#btnSave2").attr("disabled","disabled");
								  document.semesterForm.action ="${basePath}/semesterSummary/addSemesterSummary";
								  document.semesterForm.submit()
								 }
							}
						});
						  //取消
						$("#btnSave3").click(function() {
							  layer.confirm("您是否确定取消?", {icon: 3, title:'提示',skin:'layer-ext-moon'}, function(index){
								  $("#btnSave3").attr("disabled","disabled");
								  document.semesterForm.action ="${basePath}/semesterSummary/addSemesterSummaryForward";
								  document.semesterForm.submit();
							  },function(index){
									layer.close(index);
							  });
								
						});
					});
       function validateSqxm(){
    	   var p1=$('input[name="p"]:checked').val();
    	   var p21=$('input[name="p21"]:checked').val();
    	   var p22=$('input[name="p22"]:checked').val();
    	   var bool=false;
    	   if(p1!=null&&p1!=""){
    		   bool=true;
    	   }
    	   if(p21!=null&&p21!=""){
    		   bool=true; 
    	   }
    	   if(p22!=null&&p22!=""){
    		   bool=true; 
    	   }
    	   if(bool==false){
    		   layer.alert("本学期您想申请的先进项目至少选一项", {icon: 6});
    		   return false;
    	   }
    	   return bool;
       }
   	function optionRadion(){
		  var old = null; //用来保存原来的对象
		    $("input[name='p']").each(function(){//循环绑定事件
		        if(this.checked){
		            old = this; //如果当前对象选中，保存该对象
		        }
		        this.onclick = function(){
		            if(this == old){//如果点击的对象原来是选中的，取消选中
		                this.checked = false;
		                old = null;
		            } else{
		                old = this;
		            }
		        }
		    });
	}   
       

</script>
</head>
<body>
	<form action="#" id="semesterForm" name="semesterForm">
		<input type="hidden" name="token" value="${token}" />
		<input  type="hidden" id="flag" name="flag" value=""/>
		<table cellpadding="0" cellspacing="0" border="0" class="table-border"
			width="95%">
			<tr>
				<td class="table-header" colspan="6">学生个人期末总结信息</td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 12%">姓名：</td>
				<td class="table-contentTD" style="width: 22%">${student.xm}</td>
				<td class="table-titleTD"  style="width: 12%">学号：</td>
				<td class="table-contentTD" style="width: 22%">${student.xh}</td>
				<td class="table-titleTD" style="width: 12%">性别：</td>
				<td class="table-contentTD" style="width: 22%">${student.xb}</td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 12%">班级：</td>
				<td class="table-contentTD" style="width: 22%">${student.bjmc}</td>
				<td class="table-titleTD" style="width: 12%">专业：</td>
				<td class="table-contentTD" style="width: 22%">${student.zymc}</td>
				<td class="table-titleTD" style="width: 12%">年级：</td>
				<td class="table-contentTD" style="width: 22%">${student.njmc}</td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 12%">学期：</td>
				<td class="table-contentTD" style="width: 22%"><select id="semid" name="semid" class="selectList">
						<option value="">请选择</option>
							<c:forEach items="${semesterList}" var="semester">
								<option value="${semester.xqid}">${semester.xqmc}</option>
							</c:forEach>
				</select></td>
				<td class="table-titleTD" style="width: 12%">政治面貌：</td>
				<td class="table-contentTD" style="width: 22%"><select id="zzmm" name="zzmm"  class="selectList">
						<option value="">无</option>
						<c:forEach items="${sysCodeList}" var="code">
							<option value="${code.codename}">${code.codename}</option>
						</c:forEach>
				</select></td>
				<td class="table-titleTD" style="width: 12%">担任职务：</td>
				<td class="table-contentTD" style="width: 22%"><select id="drzw" name="drzw"  class="selectList">
				<option value="">请选择</option>
				 <option value="班长">班长</option>
				<option value="副班长">副班长</option>
				<option value="团支书">团支书</option>
				<option value="纪律委员">纪律委员</option>
				<option value="体育委员">体育委员</option>
				<option value="文艺委员">文艺委员</option>
				<option value="生活委员">生活委员</option>
				<option value="卫生委员">卫生委员</option>
				<option value="宣传委员">宣传委员</option>
			    <option value="组织委员">组织委员</option>
				<option value="学习委员">学习委员</option>
				<option value="班主任助理">班主任助理</option>
				<option value="无">无</option>
				</select></td>
			</tr>
			<tr>
			<td class="table-titleTD" colspan="6" style="text-align: left;">*本学期你想申请的先进项目：</td>
			</tr>
			<tr>
			 <td colspan="6" class="table-contentTD" style="color: #000000" >
			  <label><input type="radio" value="三好学生" id="p" name="p" onclick="optionRadion();"/>三好学生</label>
			 <label><input type="radio" value="好学生" id="p" name="p" onclick="optionRadion();"/>好学生</label>
			 <label><input type="radio" value="行为达标生" id="p" name="p" onclick="optionRadion();"/>行为达标生</label>
			 <label><input  type="checkbox" id="p21" name="p21" value="优秀班干部" />优秀班干部</label>
			 <label><input type="checkbox" id="p22" name="p22" value="技能特长生" />技能特长生</label>
			 </td>
			</tr>
			<tr>
			<td class="table-titleTD" style="width: 12%">本学期取得的各项荣誉：</td>
			<td colspan="5" class="table-contentTD" style="width: 22%">
			<textarea  id="hdry" name="hdry" style="width: 90%;height: 80px;" placeholder="本学期取得的各项荣誉"></textarea>
			</td>
			</tr>
			<tr>
			<td class="table-titleTD" style="width: 12%">备注：</td>
			<td colspan="5" class="table-contentTD" style="width: 22%">
			<textarea  id="remark" name="remark" style="width: 90%;height: 80px;" placeholder="备注"></textarea>
			</td>
			</tr>
		</table>
		<br />
		<table cellpadding="1" cellspacing="1" border="0" align="left">
			<tr>
				<td><input type="button" id="btnSave" autocomplete="off"  class="inputButton"
					style="text-align: center;" value="保存" /></td>
				<td><input type="button" id="btnSave2" autocomplete="off"  class="inputButton"
					style="text-align: center;" value="保存并新增" /></td>
				<td><input type="button" id="btnSave3" autocomplete="off"  class="inputButton"
					style="text-align: center;" value="取消" /></td>
				<td><input type="button" id="btnBack" autocomplete="off"  class="inputButton"
					value="返回" style="text-align: center;" /></td>
			</tr>
		</table>

	</form>
</body>
	<script type="text/javascript">
	 compareListValue(document.getElementById('semid'),'${semester.xqid}');
	 compareListValue(document.getElementById('zzmm'),'${student.zzmm}');
	 if("${msg}"!=""){
	       layer.alert("${msg}", {icon: 6});
	  } 
</script>
</html>
